package com.example.consumer;

import com.alibaba.fastjson2.JSON;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.kafka.support.Acknowledgment;
import org.springframework.stereotype.Service;

@Service
public class KafkaConsumerService {
    @KafkaListener(topics = "topic1")
    public void onMessage(String message){
        System.out.println(message);
    }

    @KafkaListener(topics = "topic_user")
    public void onMessageToUser(String message){
        System.out.println(JSON.parseObject(message, User.class));
    }

}